package main

import "fmt"

func main() {
    naturals := make(chan int)
    squares := make(chan int)

    // Counter
    go func() {
        for x := 0; x < 100; x++ {
            naturals <- x
        }
        close(naturals)
    }()

    //Square
    go func() {
        for x := range naturals {
            squares <- x * x
        }
        close(squares)
    }()

    //Print
    for x:= range squares {
        fmt.Print(x)
    }

}

